package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.application.MyApplication;
import com.rjwh.dingdong.client.constant.LocalConstant;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.ICommunityPostDigestModel;
import com.rjwh.dingdong.client.mvp.model.ICommunityPostModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by wby on 2016/6/2.
 */
public class CommunityPostDigestModel extends BaseModel implements ICommunityPostDigestModel, HttpWebServiceCallBack {

    public CommunityPostDigestModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if(getBasePresenter()!= null)getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
    }

    /**
     * 获取精华帖子列表
     *
     * @param modularid
     * @param pageNumber
     * @param isRefresh
     */
    @Override
    public void doGetDigestTopicList(String modularid, int pageNumber, boolean isRefresh) {
        Map<String, String> getModularListParams = new HashMap<String, String>();
        getModularListParams.put("modularid", modularid);
        getModularListParams.put("pageindex", Integer.toString(pageNumber));
        HttpWebService.getDataFromServer(NetConstant.COMMUNITY_GETDIGESTTOPICLIST, getModularListParams, isRefresh, this);
    }
}
